#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<time.h>
//int main()
//{
//	srand(time);
//	printf("%d", rand() % 5);
//	return 0;
//}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MOD 1000000007

int count_valid_sequences(char* s) {
    int n = strlen(s);
    int** dp = (int**)malloc((n + 1) * sizeof(int*));
    for (int i = 0; i <= n; i++) {
        dp[i] = (int*)malloc((n + 1) * sizeof(int));
        for (int j = 0; j <= n; j++) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= n; j++) {
            if (s[i] == '(') {
                dp[i + 1][j + 1] += dp[i][j];
                dp[i + 1][j + 1] %= MOD;
            }
            else {
                if (j > 0) {
                    dp[i + 1][j - 1] += dp[i][j];
                    dp[i + 1][j - 1] %= MOD;
                }
            }
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= MOD;
        }
    }

    int result = dp[n][0];
    for (int i = 0; i <= n; i++) {
        free(dp[i]);
    }
    free(dp);
    return result;
}

int main() {
    char s[5001];
    scanf("%s", s);
    int ans = count_valid_sequences(s);
    printf("%d\n", ans);
    return 0;
}